// pages/order/index.js
Page({
  data: {
    tabs: [
      {
        id: 1,
        value: "全部订单",
        isActive: true
      },
      {
        id: 2,
        value: "待付款",
        isActive: false
      },
      {
        id: 3,
        value: "待收货",
        isActive: false
      },
      {
        id: 4,
        value: "退款/退货",
        isActive: false
      }
    ],
},
changeItem(index) {
  let tabs = JSON.parse(JSON.stringify(this.data.tabs));
  tabs.forEach((v, i) => {
    i === index ? (v.isActive = true) : (v.isActive = false);
  });
  this.setData({
    tabs
  });
},
handleChange(e) {
  console.log(e.detail);
  const index = e.detail;
  this.changeItem(index)
},
onShow(e) {
  let currentPages =  getCurrentPages();
  console.log(currentPages[currentPages.length - 1].options)
  let {type} = currentPages[currentPages.length - 1].options
  this.changeItem(type -1)
// }
}})
